import timeit
import random
from qwen3_client import gen_proxy_header, Qwen3Client

# 磐智认证参数
appid = "dsjyybai"
appKey = "bb9c5100caf0f84e22d88451e94ce2bb"
capabilityname = "llmm"
appid = "cs-m-llm"
appKey = "01537606759c4046ab28bf02fd26b1f9"
capabilityname ="CustomerService"
headers = gen_proxy_header(appid, appKey, capabilityname)

# URL，办公网或呼池使用10.217.247.48，其它资源池请更换对应IP
base_url = "http://10.217.247.48:9050/llmm-prod/v1/chat/completions"
api_key = "cs-baac3b82" # "chatbi"
model = "qwen3-32b-hc"


# 定义基准测试函数
def benchmark_qwen3_client_chat():
    prompts = [
            "介绍中国的四大发明", "解释人工智能的基本概念", "描述太阳系的构成", "讲解光合作用的过程", "介绍丝绸之路的历史"
    ]
    prompt = prompts[random.randint(0, len(prompts) - 1)]
    messages= [{"role": "user","content": prompt}]
    client = Qwen3Client(headers, base_url, api_key, model, messages)
    
    client.chat(messages)

if __name__ == '__main__':
    # 运行基准测试

    print('Qwen3Client.chat 基准测试:')
    # print(timeit.timeit(benchmark_qwen3_client_chat, number=10))
    print(headers)